﻿// ***********************************************************************
// Assembly         : SecurityLayer
// Author           : LJO+01 (Laurent Jordi)
// Created          : 06-05-2013
// Last Modified By : LJO+01 (Laurent Jordi)
// Last Modified On : 06-05-2013
// ***********************************************************************
// <copyright file="_LayoutViewControllers_Base.cs" company="Copyright © Innovacall 2011">
//     Copyright (c) Copyright © Innovacall 2011. All rights reserved.
// </copyright>
// <summary></summary>
// ***********************************************************************
using System.Web.Security;
using InnovaApp.Layers.ResourcesLayer.Properties;

namespace InnovaApp.Layers.SecurityLayer.Controllers.ViewControllers.LayoutViewControllers
{
    /// <summary>
    /// Class _LayoutViewControllers_Base
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public abstract class _LayoutViewControllers_Base<T> : InnovaApp.Layers.CommonLayer.Controllers.ViewControllers.LayoutViewControllers._LayoutViewControllers_Base<T> where T : InnovaApp.Layers.CommonLayer.Models.ViewModels.LayoutViewModels._LayoutViewModels_Base
	{
        /// <summary>
        /// Errors the code to string.
        /// </summary>
        /// <param name="createStatus">The create status.</param>
        /// <returns>System.String.</returns>
		protected string ErrorCodeToString(MembershipCreateStatus createStatus)
		{
			// See http://go.microsoft.com/fwlink/?LinkID=177550 for
			// a full list of status codes.
			//ToDo uses Resources instead of strings
			switch (createStatus)
			{
				case MembershipCreateStatus.DuplicateUserName:
					return Resources.EF_MembershipProvider_CreateStatus_UserAlreadyExists;

				case MembershipCreateStatus.DuplicateEmail:
					return Resources.EF_MembershipProvider_CreateStatus_EMailAddressAlreadyUsed;

				case MembershipCreateStatus.InvalidPassword:
					return Resources.EF_MembershipProvider_CreateStatus_PasswordNotValid;

				case MembershipCreateStatus.InvalidEmail:
					return Resources.EF_MembershipProvider_CreateStatus_EMailAddressNotValid;

				case MembershipCreateStatus.InvalidAnswer:
					return Resources.EF_MembershipProvider_CreateStatus_AnswerNotValid;

				case MembershipCreateStatus.InvalidQuestion:
					return Resources.EF_MembershipProvider_CreateStatus_QuestionNotValid;

				case MembershipCreateStatus.InvalidUserName:
					return Resources.EF_MembershipProvider_CreateStatus_UserNameNotValid;

				case MembershipCreateStatus.ProviderError:
                    return Resources.EF_MembershipProvider_CreateStatus_AuthenticationProviderError;

				case MembershipCreateStatus.UserRejected:
					return Resources.EF_MembershipProvider_CreateStatus_UserRejected;

				default:
					return Resources.EF_MembershipProvider_CreateStatus_UnknownError;
			}
		}
	}
}
